package com.xuzhao.exception;

/**
 * Created by xz on 2017/9/3.
 * 自定义异常
 */

import com.xuzhao.enums.ResultEnum;

/**
 * 继承RuntimeException spring只对RuntimeException进行事务回滚
 */
public class PersonException extends RuntimeException {
    private Integer code;
    public PersonException(Integer code,String msg){
        super(msg);
        this.code = code;
    }
    public PersonException(ResultEnum resultEnum){
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
